# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: WorMzy Tykashi <wormzy.tykashi@gmail.com>
# Contributor: Alois Nespor <info@aloisnespor.info>
# Contributor: speps <speps dot aur dot archlinux dot org>

pkgbase=rssguard
pkgname=(rssguard{,-lite})
pkgver=4.3.4
pkgrel=1
pkgdesc='Simple (yet powerful) Qt feed reader'
arch=('loong64' 'x86_64')
url='https://github.com/martinrotter/rssguard'
license=('GPL3')
makedepends=('cmake' 'qt6-tools' 'qt6-multimedia' 'qt6-webengine' 'qt6-5compat')
optdepends=('clang: Support for beautification of message filter scripts'
            'mariadb-libs: Support for MariaDB-based data storage')
source=("https://github.com/martinrotter/$pkgbase/archive/$pkgver/$pkgbase-$pkgver.tar.gz")
sha256sums=('139db542e82be8c958f6a4c5e5fd0beb1c3c06a7d6b84706d0deb08131de350a')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_WITH_QT6=ON
  cmake --build build

  cmake -B build-lite -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_WITH_QT6=ON \
    -DUSE_WEBENGINE=OFF
  cmake --build build-lite
}

package_rssguard() {
  depends=('qt6-webengine' 'qt6-multimedia' 'qt6-5compat')

  DESTDIR="$pkgdir" cmake --install build
}

package_rssguard-lite() {
  pkgdesc+=' without WebEngine support'
  depends=('hicolor-icon-theme' 'qt6-declarative' 'qt6-multimedia' 'qt6-5compat')
  conflicts=(rssguard)
  provides=(rssguard=$pkgver)
  replaces=(rssguard-nowebengine)

  DESTDIR="$pkgdir" cmake --install build-lite
}
